﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace baseClass.Forms
{
    public partial class baseForm : common.forms.baseForm
    {
        public baseForm()
        {
            InitializeComponent();
            this.Font = common.Settings.sysFontMain;
            this.myOnErrorEvent += new myOnError(application.SysLibs.ErrorHandler);
        }

        public override void SetName(string name)
        {
            base.SetName(name);
            this.Text = CommonTypes.language.GetString(name);
            this.SetPermissions(application.SysLibs.GetFormPermission(name));
        }
        private void baseForm_Load(object sender, EventArgs e)
        {
            try
            {
                if (!CommonTypes.Settings.sysLogAccess) return;
                DataAccess.DataLibs.AddSysLogACCESS(this.Text, "Open");
            }
            catch (Exception er)
            {
                this.ErrorHandler(this,er);
            }
        }
        private void baseForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                if (!CommonTypes.Settings.sysLogAccess) return;
                DataAccess.DataLibs.AddSysLogACCESS(this.Text, "Closed");
            }
            catch (Exception er)
            {
                this.ErrorHandler(this,er);
            }
        }

    }
}
